/**
 * @param {number[]} nums
 * @return {void} Do not return anything, modify nums in-place instead.
 */
var moveZeroes = function(nums) {
    let left=0 //left停留在最后一个0的位置
    let right=0
    while(right<nums.length ){
        //left指针去找一个非零元素
        if(nums[right]){
            [nums[left],nums[right]]= [nums[right],nums[left]]
            left++
        }
        right++
    }

};

let nums = [0,1,0,3,12]
moveZeroes(nums)
console.log(nums);//[1,3,12,0,0]